# -*- coding:utf-8 -*-
from db.models import *
from common.utils import AESCipher


# 用户相关接口
class AccountUserProvider(object):

    def __init__(self):
        self.aes_cipher = AESCipher()

    def register_provider(self, param_info):
        try:
            # 更新数据库
            param_info["status"] = "active"
            param_info["password"] = self.aes_cipher.encrypt(param_info["password"])
            user_info_obj = AxeUserInfo.objects.create(**param_info)

            return user_info_obj

        except Exception as ex:
            raise Exception(ex)

